<?php
    $this->load->view('wx/public/header.html', [
        'time' => time(),
        'index' => 3,
        'css' => [
            'assets/wx/css/car.css',
        ]
    ]);
?>

<body class="order" ng-controller="wx-car-index-controller">

<section ng-show="loading" style="margin-top: 50px;" class="aui-content aui-text-center gu-order-empty">
    <img src="/assets/wx/img/reading.gif" alt="">
</section>

<div class="gu-car-empty" ng-show="noGoods && !loading">
    <p class="">购物车空空如也</p>
    <a href="/index">去逛逛</a>
</div>

<div class="aui-content aui-margin-b-15" ng-show="lists.length > 0 && !loading">
    <ul class="aui-list aui-select-list" style="margin-bottom: 5rem;">
        <li class="aui-list-item" style="padding-left: 0.2rem;">
            <div class="aui-list-item-inner">
                <label class="aui-font-size-14" ng-click="selectAll()">
                    <span class="gu-car-radio aui-margin-r-5 gu-select-all" ng-class="{'active': selectAllItems}"></span>
                    全部选择
                </label>
                <a href="javascript:void(0);" class="aui-pull-right aui-font-size-14 aui-text-default gu-edit" ng-click="editModel()" ng-bind="!editing ? '编辑' : '完成'">编辑</a>
            </div>
        </li>

        <li class="aui-list-item gu-list-item aui-margin-b-10" ng-repeat="(index, l) in lists">
            <div class="aui-list-item-label gu-radio-box" ng-click="select(index)">
                <span class="gu-car-radio" ng-class="{'active': l.selected == 1}"></span>
            </div>
            <div class="aui-list-item-inner gu-car-box">
                <div style="float: left;" class="gu-car-media aui-margin-r-10">
                    <img ng-src="{{ l.thumb }}" alt="">
                </div>
                <div class="gu-car-desc">
                    <div class="gu-car-header">
                        <p class="aui-ellipsis-2 gu-car-goods-name aui-font-size-14" ng-bind="l.goodsName"></p>
                        <strong class="gu-car-goods-price aui-text-right aui-font-size-16">
                            <span ng-bind="'￥' + l.price_cny"></span>
                            <br>
                            <i class="aui-font-size-12" ng-bind="'x ' + l.num"></i>
                        </strong>
                    </div>
                    <div class="gu-car-footer">
                        <span ng-show="!editing" class="gu-stock-desc aui-margin-t-10" ng-bind="'库存 ' + l.stock + ' 件'"></span>
                        <div ng-show="editing" class="gu-btn-area aui-padded-t-5">
                            <div class="num">
                                <button type="button" ng-click="modifyNum(index, l, 'down')">-</button>
                                <span ng-bind="l.num"></span>
                                <button type="button" ng-click="modifyNum(index, l, 'up')">+</button>
                            </div>
                        </div>
                        <a href="javascript:void(0);" ng-show="editing" class="gu-btn-delete aui-text-default" ng-click="delete(index, l)">删除</a>
                        <a href="javascript:void(0);" ng-show="!editing" class="gu-btn-delete aui-text-default" ng-bind="l.ruleName"></a>
                    </div>
                </div>
            </div>
        </li>

    </ul>
</div>

<div class="aui-content gu-car-alert aui-padded-l-15" ng-if="total > 0">
   <strong>
       合计: <span style="color: red;" ng-bind="'￥' + total"></span>
   </strong>
    <a href="javascript:void(0);" ng-click="goConfirm()">去结算</a>
</div>

<?php
    $this->load->view('wx/public/footer.html', [
        'time' => time(),
        'js' => [
            'assets/wx/js/car/index.js'
        ]
    ]);
?>